<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计费后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/wbox.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/wbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		$(".list div").mousemove(function(){
			$(this).css("background","#E3EEFF");
		}).mouseout(function(){
			$(this).css("background","");
		});
		$("#productId").val('${productId}');
		$("#userType").val('${userType}');
		$("#addBilling").click(function(){
			var wBox = $("#ajax").wBox({
				requestType: "iframe",
				iframeWH:{width:900,height:500},
				target:"<%=request.getContextPath() %>/admin/billing/addUI",
				title: "添加计费点"
			});
			wBox.showBox();
		});
	});

	function del(billingId){
		if(confirm("你确认删除该计费点吗?")){
			$.ajax({
				url:"<%=request.getContextPath() %>/admin/billing/del/"+billingId,
				type:"GET",
				success:function(flag){
					if(flag=='1'){
						alert("删除成功!");
						window.location.href="<%=request.getContextPath() %>/admin/billing/list?productId="+$('#productId').val()+"&userType="+$('#userType').val();
					}else{
						alert("删除失败!");
					}
				}
			});
		}
	}

	function sp(billingId,billingName){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:900,height:500},
			target:"<%=request.getContextPath() %>/admin/billingSp/hasjoin/"+billingId,
			title: billingName+"计费点-->绑定SP"
		});
		wBox.showBox();
	}


	function show(billingId){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:900,height:500},
			target:"<%=request.getContextPath() %>/admin/billing/view?billingId="+billingId,
			title: "查看计费点"
		});
		wBox.showBox();
	}

//-->
</script>
</head>
<body>
<div class="information">
	<div class="title">
		计费点列表
	</div>
	<div class="search">
		<form action="<%=request.getContextPath() %>/admin/billing/list" method="post">
		产品：
		<select name="productId" id="productId" style="width: 120px;">
			<option value="0">-----请选择-----</option>
			<c:forEach items="${productList}" var="product">
				<option value="${product.productId }">${product.productName }</option>
			</c:forEach>
		</select>
		用户类型：
		<select name="userType" id="userType" style="width:120px;">
			<option value="">-----请选择-----</option>
			<option value="0">白名单</option>
			<option value="1">灰名单</option>
			<option value="2">黑名单</option>
		</select>
		<input type="submit" value="查询">
		</form>
	</div>
	<div class="listTitle">
		<ul>
			<li style="width:50px;">编号</li>
			<li style="width:100px;">产品</li>		
			<li style="width:200px;">计费点名称</li>		
			<li style="width:50px;">资费</li>
			<li style="width:60px;">计费类型</li>
			<li style="width:80px;">提示类型</li>
			<li style="width:100px;">用户类型</li>
			<li style="width:150px;">创建时间</li>
			<li style="width:200px;">操作</li>
		</ul>
		<div class="clear"></div>
	</div>
	<div class="list">
		<c:forEach items="${pageBean.result}" var="billing" varStatus="status">
			<div class="${status.index%2==0?'noselect':'select' }">
				<ul>
					<li style="width:50px;">${billing.billingId}</li>
					<li style="width:100px;">${billing.productName }</li>	
					<li style="width:200px;">${billing.billingName }</li>		
					<li style="width:50px;">${billing.fee }</li>
					<li style="width:60px;">
						<c:choose>
							<c:when test="${billing.billingType==0 }">点播</c:when>
							<c:when test="${billing.billingType==1 }">假包月</c:when>
							<c:when test="${billing.billingType==2 }">包月</c:when>
						</c:choose>
					</li>
					<li style="width:80px;">
						<c:choose>
							<c:when test="${billing.tipType==0 }">不提示</c:when>
							<c:when test="${billing.tipType==1 }">每次都提示</c:when>
							<c:when test="${billing.tipType==2 }">只首次提示</c:when>
							<c:when test="${billing.tipType==3 }">确认型</c:when>
							<c:when test="${billing.tipType==4 }">确认超时型</c:when>
							<c:when test="${billing.tipType==5 }">确认取消型</c:when>
						</c:choose>
					</li>
					<li style="width:100px;">
						<c:choose>
							<c:when test="${billing.userType==0 }">白名单</c:when>
							<c:when test="${billing.userType==1 }">灰名单</c:when>
							<c:when test="${billing.userType==2 }">黑名单</c:when>
						</c:choose>
					</li>
					<li style="width:150px;">${billing.createTime }</li>
					<li style="width:200px;">
						<a href="#" onclick="del('${billing.billingId}')">删除</a>
						<a href="#" onclick="show('${billing.billingId}')">查看</a>
						<a href="#" onclick="sp('${billing.billingId}','${billing.billingName}')" >绑定SP</a>
					</li>
				</ul>
				<div class="clear"></div>
			</div>
		</c:forEach>
	</div>
	<jsp:include page="../page.jsp" flush="true"></jsp:include>
	<div class="search">
		<input type="button" name="addBilling" id="addBilling" value="添加新的计费点==>>" />
	</div>
</div>
</body>
</html>